#! /usr/bin/env python
#-*- coding: utf-8 -*-

test1 = lambda a, b, c: a or b and c
test2 = lambda a, b, c: (a or b) and c

print 'Output:\n'
for a in (True, False):
    for b in (True, False):
        for c in (True, False):
            print a, '\t', b, '\t', c, '\t==>\t', test1(a, b, c), '\t', test2(a, b, c)

"""
Output:

True    True    True    ==>     True    True
True    True    False   ==>     True    False
True    False   True    ==>     True    True
True    False   False   ==>     True    False
False   True    True    ==>     True    True
False   True    False   ==>     False   False
False   False   True    ==>     False   False
False   False   False   ==>     False   False
"""

test3 = lambda a, b, c: a and b or c
test4 = lambda a, b, c: (a and b) or c

print '\nOutput:\n'
for a in (True, False):
    for b in (True, False):
        for c in (True, False):
            print a, '\t', b, '\t', c, '\t==>\t', test3(a, b, c), '\t', test4(a, b, c)

"""
Output:

True    True    True    ==>     True    True
True    True    False   ==>     True    True
True    False   True    ==>     True    True
True    False   False   ==>     False   False
False   True    True    ==>     True    True
False   True    False   ==>     False   False
False   False   True    ==>     True    True
False   False   False   ==>     False   False
"""